package com.lxy.fun4;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Test {
    public static void t01(String s,Fun fun){
        fun.fun(s);
    }
    public static void t02(String s){
        System.out.println(s);
    }

    public static void main(String[] args) {
        t01("123", Test::t02);
        t02("123");
//        ArrayList<String> list = new ArrayList<>();
//        Collections.addAll(list,"zhao","d1wdaddq","ASDINAOSDN","aa","AA");
//        Collections.sort(list, new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                return o1.compareTo(o2);
//            }
//        });
//        System.out.println(list);
//        //lambda
//        Collections.sort(list,((o1, o2) -> o1.compareTo(o2)));
//        //特定类型的方法引用
//        //类名::非静态方法
//        list.sort(String::compareTo);
    }
}

@FunctionalInterface
interface Fun{
    public void fun(String s);
}
